package com.github.prontera.domain.enums;

import com.github.prontera.common.mybatis.handler.CodeEnum;

/**
 * 通用枚举类型
 */
public enum RegisterChannelEnum implements CodeEnum<RegisterChannelEnum> {

	BASE_ANDROID_APP(0, "原生APP"),BASE_IOS_APP(1, "原生APP"),
	
	APP_ANDROIR_WECHAT(2, "APP--ANDROID-->微信"),APP_IOS_WECHAT(3, "APP--IOS-->微信")
	
	,APP_ANDROID_WEOBO(4, "APP--ANDROID-->微博"), APP_IOS_WEOBO(5, "APP--IOS-->微博"), 
	
	APP_ANDROID_QQ(6, "APP--ANDROID-->QQ"),APP_IOS_QQ(7, "APP--IOS-->QQ"),
	
	APP_MP(8, "微信公众号"), 
	
	PC(9, "PC");

	private int code;
	private String desc;

	private RegisterChannelEnum(int code, String desc) {
		this.code = code;
	}

	/**
	 * 通过枚举<code>name</code>获取枚举
	 */
	public static RegisterChannelEnum getEnumByCode(Integer code) {
		if (code == null) {
			return null;
		}
		for (RegisterChannelEnum enumm : RegisterChannelEnum.values()) {
			if (enumm.getCode() == code.intValue()) {
				return enumm;
			}
		}
		return null;
	}

	@Override
	public int getCode() {
		return code;
	}

	public String getDesc() {
		return desc;
	}

}
